package com.cy.mall.web.front.brand;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.cy.mall.model.PageBean;
import com.cy.mall.model.Result;
import com.cy.mall.model.query.brand.BrandListQuery;
import com.cy.mall.model.vo.brand.BrandDetailVO;
import com.cy.mall.model.vo.brand.BrandListVO;
import com.cy.mall.model.vo.brand.BrandRecommendListVO;
import com.cy.mall.model.vo.brand.EnableBrandListVO;
import com.cy.mall.service.brand.BrandRecommendService;
import com.cy.mall.service.brand.BrandService;
import com.cy.mall.web.BaseController;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 前台-品牌管理
 *
 * @author tanyilin
 *
 * @create 2019年1月24日 上午10:06:28
 */
@RestController
@RequestMapping("/brand")
@Api(tags = "前台-品牌管理")
public class BrandController extends BaseController {

	@Autowired
	private BrandRecommendService brandRecommendService;
	@Autowired
	private BrandService brandService;
	
	@ApiOperation("品牌推荐列表")
	@GetMapping("/get/brand/recommend/list")
	public Result<List<BrandRecommendListVO>> getBrandRecommendList() {
		List<BrandRecommendListVO> list = brandRecommendService.selectBrandRecommendList();
		return ok("", list);
	}
	
	@ApiOperation("品牌列表")
	@GetMapping("/get/brand/list")
	public PageBean<BrandListVO> getBrandList(BrandListQuery query) {
		PageBean<BrandListVO> pageBean = brandService.selectBrandList(query);
		return pageBean;
	}
	
	@ApiOperation("品牌详情")
	@GetMapping("/get/brand/detail")
	public Result<BrandDetailVO> getBrandDetail(@RequestParam(value = "brandId") Long brandId) {
		BrandDetailVO brandDetail = brandService.selectBrandDetail(brandId);
		return ok("", brandDetail);
	}
	
	@ApiOperation("所有启用状态的品牌列表")
	@GetMapping("/get/all/enable/list")
	public Result<List<EnableBrandListVO>> allEnableBrandList() {
		List<EnableBrandListVO> list = brandService.allEnableBrandList();
		return ok("", list);
	}
	
	
}
